﻿

using IotContract.Enums;
using IotContract.Interfaces.Process;
using IotContract.Models.Process;
using IotContract.Models.Process.Zd;
using Mapster;
using QjServerProcess.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QjServerProcess;
public class ProcessOpenProvider : IProcessOpenProvider
{
    private readonly IProcessDataService _processDataService;
    private readonly IProcessJobService _processJobService;
    public ProcessOpenProvider(IProcessDataService processDataService, IProcessJobService processJobService)
    {
        _processDataService = processDataService;
        _processJobService = processJobService;
    }

    public string AddJob(ProcessBaseData job, ProcessProviderType type)
    {
        throw new NotImplementedException();
    }

    public List<ProcessBaseData> GetJobs(ProcessProviderType type)
    {
        return new List<ProcessBaseData>();
    }
    /// <summary>
    /// 获取堆垛机数据
    /// </summary>
    /// <returns></returns>
    public List<ProcessBaseData> GetStackers()
    {
        var datas = _processDataService.ScUnits.Values.ToList(); 
        List<ProcessBaseData> scUnits = new List<ProcessBaseData>();

        foreach (var data in datas)
        {

            ZdProcessScData cv = data.Adapt<ZdProcessScData>();
            cv.Num = data.EquipNum;

            scUnits.Add(cv);
        }

        return scUnits;
    }
    /// <summary>
    /// 获取物流线数据
    /// </summary>
    /// <returns></returns>
    public List<ProcessBaseData> GetUnitCVs()
    {
        var datas = _processDataService.CvUnitTags.Values.ToList();
        List<ProcessBaseData> cvUnits = new List<ProcessBaseData>();

        foreach (var data in datas)
        {

            ZdProcessCvData cv = data.Adapt<ZdProcessCvData>();
            cv.Num = data.TagNum;

            cvUnits.Add(cv);
        }

        return cvUnits;
    }

    public string RemoveJob(ProcessBaseData job, ProcessProviderType type)
    {
        throw new NotImplementedException();
    }
}
